<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>退货商品管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="/favicon.ico">
    <link rel="stylesheet" href="/resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<!-- 查询条件开始 -->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 5px;">
    <legend>查询条件</legend>
</fieldset>
<blockquote class="layui-elem-quote">
    <form action="" method="post" id="searchFrm" lay-filter="searchFrm" class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">供应商名称</label>
                <div class="layui-input-inline">
                    <select name="providerid" id="search_providerid">
                        <option value="">请选择供应商</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">商品名称</label>
                <div class="layui-input-inline">
                    <select name="goodsid" id="search_goodsid">
                        <option value="">请选择商品</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                    <input type="tel" name="startTime" id="startTime" readonly="readonly" placeholder="yyyy-MM-dd HH:mm:ss" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <input type="tel" name="endTime"  id="endTime"  readonly="readonly" placeholder="yyyy-MM-dd HH:mm:ss" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">操作员</label>
                <div class="layui-input-inline">
                    <input type="text" name="operateperson"   autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline" style="text-align: center;">
                    <button type="button" class="layui-btn" lay-submit="" lay-filter="doSearch"><span class="layui-icon layui-icon-search"></span>查询</button>
                    <button type="reset" class="layui-btn layui-btn-warm"><span class="layui-icon layui-icon-refresh-1"></span>重置</button>
                </div>
            </div>
        </div>
    </form>
</blockquote>
<!-- 查询条件结束-->
<!-- 数据表格开始 -->
<div>
    <table class="layui-hide" id="outportTable" lay-filter="outportTable"></table>
</div>
<!-- 数据表格结束 -->
<script type="text/javascript" src="/resources/layui/layui.js"></script>
</body>
</html>
<script>
    layui.use(['jquery','form','table','laydate'],function () {
        var $=layui.jquery;
        var form = layui.form;
        var table = layui.table;
        var laydate = layui.laydate;

        //渲染时间选择器
        laydate.render({
            elem:"#startTime",
            type:"datetime"
        });
        laydate.render({
            elem:"#endTime",
            type:"datetime"
        });

        //加载表格数据
        var tableIns = table.render({
            elem: '#outportTable'
            ,url:'/outport/loadAllOutport'
            ,toolbar: '#outportToolBar' //开启头部工具栏，并为其绑定左侧模板
            ,title: '退货商品数据表'
            ,height:'full-180'
            ,page: true
            ,cols: [ [
                {field:'id', title:'退货ID',align:'center'}
                ,{field:'providername', title:'供应商',align:'center'}
                ,{field:'goodsname', title:'商品名称',align:'center'}
                ,{field:'paytype', title:'支付类型',align:'center'}
                ,{field:'outputtime', title:'退货时间',align:'center'}
                ,{field:'operateperson', title:'操作员',align:'center'}
                ,{field:'number', title:'退货数量',align:'center'}
                ,{field:'size', title:'退货规格',align:'center'}
                ,{field:'outportprice', title:'退货价格',align:'center'}
                ,{field:'remark', title:'备注',align:'center'}
            ] ]

        });

        //模糊查询
        form.on("submit(doSearch)",function(data){
            tableIns.reload({
                where:data.field,
                page:{
                    curr:1
                }
            });
            return false;
        });
        //加载查询条件供应商的下拉列表
        $.get("/provider/loadAllProviderForSelect",function (res) {
            var data = res.data;
            var dom = $("#search_providerid")
            var html = '<option value="">请选择供应商</option>';
            $.each(data,function (index,item) {
                html+='<option value="'+item.id+'">'+item.providername+'</option>';
            });
            dom.html(html);
            form.render("select")
        })
        //加载查询条件商品的下拉列表
        $.get("/goods/loadAllGoodsForSelect",function (res) {
            var data = res.data;
            var dom = $("#search_goodsid")
            var html = '<option value="">请选择商品</option>';
            $.each(data,function (index,item) {
                html+='<option value="'+item.id+'">'+item.goodsname+'【'+item.providername+'】'+'</option>';
            });
            dom.html(html);
            form.render("select")
        })
    })
</script>
